<template>
  <div class="ranking_table">
    <!-- 表头 -->
    <div class="table_header">
      <span>排名</span>
      <span>会员</span>
      <span>积分</span>
      <span>奖金</span>
    </div>
    <!-- 表体 -->
    <div class="table_body">
      <div class="table_row" v-for="(item, index) in tableData" :key="index">
        <div class="rank" >
          {{ index + 1 }}
        </div>
        <div class="member">{{ item.member }}</div>
        <div class="score">{{ item.score }}</div>
        <div class="bonus">{{ item.bonus }}</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";

// 表格数据
const tableData = ref([
  { member: "frank001", score: 12231, bonus: 588 },
  { member: "frank001", score: 333, bonus: 388 },
  { member: "frank001", score: 12231, bonus: 588 },
  { member: "frank001", score: 333, bonus: 388 },
  { member: "frank001", score: 12231, bonus: 588 },
  { member: "frank001", score: 333, bonus: 388 },
]);

// // 奖牌图片
// const medals = [
//   "/imgs/club/no1.png", // 金牌
//   "/imgs/club/no2.png", // 银牌
//   "/imgs/club/no3.png", // 铜牌
// ];

// // 定义方法，根据 index 返回对应的颜色
// const getColor = (index: number): string => {
//   if (index === 0) return '#FFB700';
//   if (index === 1) return '#C4C4C4';
//   if (index === 2) return '#E89160';
//   return '#FFFFFF'; // 默认颜色
// };
</script>

<style scoped lang="scss">
.ranking_table {
  width: 347px;
  margin: 0 auto;
  background-color: #131232;
  border-radius: 10px;
  overflow: hidden;
  color: #fff;
  font-family: Arial, sans-serif;
}

.table_header {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background-color: #5567ff;
  font-weight: bold;
  text-align: center;

  span {
    flex: 1;
  }
}

.table_body {
  .table_row {
    height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 400;

    &:nth-child(odd) {
      // background-color: rgba(255, 255, 255, 0.05);
      background: #1B1A44;
    }

    .rank {
      flex: 1;
      display: flex;
      justify-content: center;
      align-items: center;

      img {
        width: 28px;
        height: 32px;
      }
    }

    .member {
      flex: 1;
    }

    .score {
      flex: 1;
    }

    .bonus {
      flex: 1;
      color: #FF9F69;
    }
  }
}
</style>
